import { ROLE_LIST } from '../auth/role';

// Monitor Module
const Monitor = {
  text: '监控中心',
  link: '/layout/monitor',
  icon: 'iconfont iconpingtaitongji'
};
// BulletinManage Module
const BulletinManage = {
  text: '看板',
  link: '/layout/bulletin-board',
  icon: 'iconfont iconweiruan'
}
// Project Module
const ProjectManage = {
  text: '项目',
  link: '/layout/project',
  icon: 'iconfont iconrenzhengdunpaianquanbaozhangzhibao'
};

// Application Module
const appManage = {
  text: '应用',
  link: '/layout/application',
  icon: 'iconfont iconzujian'
};

// Resource Module
const ResourceManage = {
  text: '软件资产',
  icon: 'iconfont icondisanfangku',
  subMenus: []
};
const ResourceLocation = {
  text: '资产分布',
  link: '/layout/assets-management/resource-location'
};
const ThirdLibrary = {
  text: '第三方库',
  link: '/layout/assets-management/library'
};
const Container = {
  text: '容器',
  link: '/layout/assets-management/container',
};
const License = {
  text: 'License',
  link: '/layout/assets-management/license'
};
const Baseline = {
  text: '安全基线',
  link: '/layout/assets-management/baseline',
};


// Threat Module
const ThreatManage = {
  text: '风险管控',
  icon: 'iconfont iconrongqi',
  subMenus: []
};
const ThreatLoaction = {
  text: '威胁分布',
  link: '/layout/threat/threat-location',
};
const ThreatList = {
  text: '威胁列表',
  link: '/layout/threat/threat-list',
};
const ThreatControl = {
  text: '威胁管控',
  link: '/layout/threat/threat-workflow',
};



// Platform Module
const PlateManage = {
  text: '平台管理',
  icon: 'iconfont iconweiruan',
  subMenus: []
};
const DataCenter = {
  text: '数据中心',
  link: '/layout/platform/data-center',
};

// 小组管理员
const CommonUsers = {
  text: '用户管理',
  link: '/layout/platform/common-users',
};

// 企业管理员：小组用户 和 普通用户
const GroupUsers = {
  text: '小组管理',
  link: '/layout/platform/group-users',
};
const Users = {
  text: '用户管理',
  link: '/layout/platform/users',
};

// 超级管理员
const OrgUsers = {
  text: '企业客户',
  link: '/layout/platform/org-users',
};

// Setting Module
const Setting = {
  text: '设置',
  icon: 'iconfont iconxitongguanli',
  subMenus: []
};
const EmailConfig = {
  text: '邮件系统配置',
  link: '/layout/setting/email-config',
};
// iadp配置
const IdapConfig = {
  text: 'Idap配置',
  link: '/layout/setting/idap-config',
};

// iadp配置
const UserToken = {
  text: '用户令牌',
  link: '/layout/setting/user-token',
};

export const Menus = {
  [ROLE_LIST.superadmin]: [
    Monitor,
    BulletinManage,
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ResourceLocation, ThirdLibrary, Container, License, Baseline] }),
    Object.assign({}, ThreatManage, { subMenus: [ThreatLoaction, ThreatList, ThreatControl] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, OrgUsers] }),
    Object.assign({}, Setting, { subMenus: [EmailConfig, IdapConfig] }),
  ],
  [ROLE_LIST.orgadmin]: [
    Monitor,
    BulletinManage,
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ResourceLocation, ThirdLibrary, Container, License, Baseline] }),
    Object.assign({}, ThreatManage, { subMenus: [ThreatLoaction, ThreatList, ThreatControl] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, GroupUsers, Users] }),
    Object.assign({}, Setting, { subMenus: [UserToken] }),
  ],
  [ROLE_LIST.groupadmin]: [
    Monitor,
    BulletinManage,
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ResourceLocation, ThirdLibrary, Container, License, Baseline] }),
    Object.assign({}, ThreatManage, { subMenus: [ThreatLoaction, ThreatList, ThreatControl] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, CommonUsers] }),
    Object.assign({}, Setting, { subMenus: [UserToken] }),
  ],
  [ROLE_LIST.groupuser]: [
    Monitor,
    BulletinManage,
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ResourceLocation, ThirdLibrary, Container, License, Baseline] }),
    Object.assign({}, ThreatManage, { subMenus: [ThreatLoaction, ThreatList, ThreatControl] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter] })
  ],
  [ROLE_LIST.secadmin]: [
    Monitor,
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ResourceLocation, ThirdLibrary, Container, License, Baseline] }),
    Object.assign({}, ThreatManage, { subMenus: [ThreatLoaction, ThreatList, ThreatControl] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, GroupUsers, Users] })
  ],
  [ROLE_LIST.secuser]: [
    Monitor,
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ResourceLocation, ThirdLibrary, Container, License, Baseline] }),
    Object.assign({}, ThreatManage, { subMenus: [ThreatLoaction, ThreatList, ThreatControl] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, GroupUsers, Users] })
  ],
  [ROLE_LIST.devadmin]: [
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ThirdLibrary, License] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, GroupUsers, Users] })
  ],
  [ROLE_LIST.devUser]: [
    ProjectManage,
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [ThirdLibrary, License] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, GroupUsers, Users] })
  ],
  [ROLE_LIST.opadmin]: [
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [Container, Baseline] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, GroupUsers, Users] })
  ],
  [ROLE_LIST.opuser]: [
    appManage,
    Object.assign({}, ResourceManage, { subMenus: [Container, Baseline] }),
    Object.assign({}, PlateManage, { subMenus: [DataCenter, GroupUsers, Users] })
  ]
};

